UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T49vgnBXZgFJsbMfspilZVR11HJcHgDVpUW8WButPU4=' 
WHERE 
  key_id = '802a15d0a8b7c42c0a93c43d2beda90288ef9b92303fed9d63ca8fc073d985e3' 
  AND (
    token = 'T49vgnBXZgFJsbMfspilZVR11HJcHgDVpUW8WButPU4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039