UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PhZ8XEVGp2FmiaB1rgbLkFpxizVwImIJ18dHMl3fRU0=' 
WHERE 
  key_id = 'ae5865499f8b26630183cbe7286bb64f681a1ea7956792d7f6fb18677d077000' 
  AND (
    token = 'PhZ8XEVGp2FmiaB1rgbLkFpxizVwImIJ18dHMl3fRU0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023