UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'so2v+pB9Jc/0LU1DNvRu5stblGrV76qd8zhl1tq4q6E=' 
WHERE 
  key_id = 'b9eabed979e8e0690f87819a6c6562921a38780d310dc00504f95dbfb5d2fa9a' 
  AND (
    token = 'so2v+pB9Jc/0LU1DNvRu5stblGrV76qd8zhl1tq4q6E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035