UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gGW2QvmzCdXxhDIilf4dL+SIb1GjO25ChCrazQqwPrw=' 
WHERE 
  key_id = '5051ad83d2d81269650b86d7a19146a7dea865564a6c20e7153b9084225a9d01' 
  AND (
    token = 'gGW2QvmzCdXxhDIilf4dL+SIb1GjO25ChCrazQqwPrw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027