UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gL38+5mg1ZF/8uR3mUYmbVgyPSIPuNYJmtkxOszduO8=' 
WHERE 
  key_id = '13e2e1144f4a11ff2d9f5aeb4c2cb1f575ea13edbc3cee04c66a779f590fbfd9' 
  AND (
    token = 'gL38+5mg1ZF/8uR3mUYmbVgyPSIPuNYJmtkxOszduO8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027