UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EF+9SuPLGB9Fhq6STQdK01WYqTLAVRgadckNxg/qrCQ=' 
WHERE 
  key_id = 'f001fa5714090c38788405185c80d8899adeef22aa573fc4b7f84dfc3121d6f4' 
  AND (
    token = 'EF+9SuPLGB9Fhq6STQdK01WYqTLAVRgadckNxg/qrCQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030